//
//  SY_Today_AttCell.m
//  ChatDemo-UI2.0
//
//  Created by Sylar on 2017/2/21.
//  Copyright © 2017 Sylar. All rights reserved.
//

#import "SY_Today_AttCell.h"

@implementation SY_Today_AttCell {
    
    UILabel *nameLabel;
    UILabel *detailLabel;
    
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    if (self == [super initWithStyle:style reuseIdentifier:reuseIdentifier])  {
        
        nameLabel = [[UILabel alloc]initWithFrame:CGRectMake(15, 0, 200, 44)];
        [nameLabel setFont:[UIFont systemFontOfSize:16]];
        [nameLabel setTextColor:colorFromHex(@"#3b3b3b")];
        [self.contentView addSubview:nameLabel];
        
        detailLabel = [[UILabel alloc]initWithFrame:CGRectMake(SCREENWIDTH - 130, 0, 100, 44)];
        [detailLabel setFont:[UIFont systemFontOfSize:14]];
        detailLabel.textAlignment = NSTextAlignmentRight;
        [detailLabel setTextColor:colorFromHex(@"#979797")];
        [self.contentView addSubview:detailLabel];
        
        self.lineView = [[UIView alloc]initWithFrame:CGRectMake(15, 43.5, SCREENWIDTH, 0.5)];
        [self.lineView setBackgroundColor:colorFromHex(@"#DEDEDE")];
        [self.contentView addSubview:self.lineView];
        
    }
    
    return self;
}

- (void)creatCell:(NSDictionary *)detailDic {
    
    nameLabel.text = [detailDic objectForKey:@"username"];
    
    if (![[detailDic objectForKey:@"eventname"] isEqualToString:@"旷课"]) {
        detailLabel.text = [detailDic objectForKey:@"eventname"];
    }else {
        detailLabel.text = @"";
    }
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
